#ifndef CAMERA_CV_H
#define CAMERA_CV_H
#include "stdafx.h"
#include <QtWidgets/QWidget>
#include "ui_camera_cv.h"
#include <Windows.h>
#include "CvThread.h"
#include "RecordWidget.h"
#include "ComThread.h"

class PressLabel : public QLabel {
	Q_OBJECT
		signals :
	void mousePressed(const QPoint&);

public:
	PressLabel(QWidget* parent = 0, Qt::WindowFlags f = 0);
	PressLabel(const QString& text, QWidget* parent = 0, Qt::WindowFlags f = 0);

	void mousePressEvent(QMouseEvent*);
};

class camera_cv : public QWidget
{
	Q_OBJECT

public:
	camera_cv(QWidget *parent = 0);
	~camera_cv();
	public slots:
	void showGridButtonClicked();
	void comActionTriggerred();
	void cvActionTriggerred();
	void startVideo();
	void gotNewImage(QImage);
	void capture();
	void gotCom(int, int);
	void gotComData(QList<int>);
	void gotComInfo(QList<int>);
	void gotInfo(QString);
	void toggleCalibrating();
	void pressed(const QPoint&);
	bool close();
	void phase1(int, int);
	void thePhase1();
	void phase1FromFile();
	void phase2FromFile();
private:
	bool sent = false;
	// buttons and labels
	PressLabel *cameraLabel;
	CvThread *cvThread = NULL;
	ComThread *comThread = NULL;
	QPushButton *comButton;
	QPushButton *captureButton;
	QPushButton *showGridButton;
	QPushButton *startVideoButton;
	QPushButton *calibrateButton;
	QPushButton *calibrateStep1Button;
	QPushButton *phase1FromFileButton;
	QPushButton *phase2FromFileButton;
	QLabel *infoLabel;
	QLabel *currentText;
	Ui::camera_cvClass ui;
};


#endif // CAMERA_CV_H
